# Badge

A badge can be commonly used as a notification or number indicator.

## Import

```jsx
import { Badge } from 'bumbag';
```

## Usage

```jsx-live
<Badge>
  1
</Badge>
```

### No content

```jsx-live
<Badge />
```

### Colors

```jsx-live
<Set spacing="minor-1">
  <Badge palette="primary">12</Badge>
  <Badge palette="secondary">12</Badge>
  <Badge palette="info">12</Badge>
  <Badge palette="success">12</Badge>
  <Badge palette="warning">12</Badge>
  <Badge palette="danger">12</Badge>
</Set>
```

### Sizes

```jsx-live
<Set spacing="minor-1">
  <Badge>
    1
  </Badge>
  <Badge size="medium">
    1
  </Badge>
  <Badge size="large">
    1
  </Badge>
</Set>
```

### Attachment

You can attach a badge onto a component by providing it as a child of the component.

```jsx-live
<Button>
  Hello world
  <Badge isAttached palette="danger" />
</Button>
<Button size="large" marginLeft="major-2">
  Hello world
  <Badge isAttached palette="danger" size="large">1</Badge>
</Button>
<Box backgroundColor="primary" color="white" marginTop="major-2">
  Hello world
  <Badge isAttached palette="danger">1</Badge>
</Box>
```

## Props

### Badge Props

<!-- Automatically generated -->

**<Code fontSize="150" marginRight="major-1">isAttached</Code>** <Code fontSize="100" palette="primary">boolean</Code> 

Indicates if the badge is attached to it's parent.

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">palette</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`"default"
  | "primary"
  | "secondary"
  | "success"
  | "danger"
  | "warning"
  | (string & {})`}
</Code>

The color of the badge.

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">size</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`"default"
  | (string & {})
  | "small"
  | "medium"
  | "large"`}
</Code>

The size of the badge.

<Divider marginTop="major-2" marginBottom="major-2" />

<details><Box use="summary" marginBottom="major-2">Inherits <strong><code>Box</code></strong> props</Box>

**<Code fontSize="150" marginRight="major-1">use</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`string
  | (ComponentClass<any, any> & { useProps: any; })
  | (FunctionComponent<any> & { useProps: any; })`}
</Code>

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">className</Code>** <Code fontSize="100" palette="primary">string</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">children</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`string
  | number
  | boolean
  | {}
  | ReactElement<any, string
  | ((props: any) => ReactElement<any, string
  | ...
  | (new (props: any) => Component<any, any, any>)>)
  | (new (props: any) => Component<...>)>
  | ReactNodeArray
  | ReactPortal
  | ((props: BoxProps) => ReactNode)`}
</Code>

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">alignX</Code>** <Code fontSize="100" palette="primary">&#34;right&#34; | &#34;left&#34; | &#34;center&#34;</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">alignY</Code>** <Code fontSize="100" palette="primary">&#34;top&#34; | &#34;bottom&#34; | &#34;center&#34;</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">variant</Code>** <Code fontSize="100" palette="primary">string</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">colorMode</Code>** <Code fontSize="100" palette="primary">string</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">disabled</Code>** <Code fontSize="100" palette="primary">boolean</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">overrides</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`{
  useCSSVariables?: boolean;
  altitudes?: AltitudesThemeConfig;
  borders?: BordersThemeConfig;
  borderRadii?: BorderRadiiThemeConfig;
  ... 96 more ...;
  Template?: TemplateThemeConfig;
}`}
</Code>

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">elementRef</Code>** <Code fontSize="100" palette="primary">((instance: any) =&#62; void) | RefObject&#60;any&#62;</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">themeKey</Code>** <Code fontSize="100" palette="primary">string</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

</details>
            

## Theming

<Theme
  component={'Badge'}
  overrides={[
    'Badge.styles.base',
    'Badge.styles.sizes.default',
    { key: 'Badge.styles.sizes.medium', props: { size: 'medium' } },
    { key: 'Badge.styles.sizes.large', props: { size: 'large' } }
  ]}>
  1
</Theme>
